<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        alert(typeof(a));  //弹出框

        var num = 123.45678;
        console.log(num.toFixed(3)); //保留三位小数，四舍五入,而且结果为字符串
    </script>
</body>
</html>